package com.tao.poly_.test;

import jdk.nashorn.internal.ir.CallNode;

public class main {
    public static void main(String[] args) {


   Cat cat1 = new Cat("小花");
        Say(cat1);
    Dog dog2 = new Dog("大黑");
        Say(dog2);
//        cat1.say();
//        Cat cat2 = new Cat("小白");
//        cat2.say();
//        Dog dog1 = new Dog("大黄");
//        dog1.say();

    }
    public static void Say(Animal2 animal2) {
        if(animal2 instanceof Cat) {
            Cat cat = (Cat) animal2;
            cat.say();
        } else if(animal2 instanceof Dog) {
            Dog dog = (Dog) animal2;
            dog.say();
        }

    }
}
